"""Exception classes for Tortuga"""

from textwrap import dedent
from traceback import format_stack

__all__ = []

class TortugaBug(Exception):
    """Error indicates a bug in the Tortuga API"""
    def __init__(self, message=""):
        super(TortugaBug, self).__init__()
        self.message = (
            "Unrecoverable Error!\n" + message + "\n" +
            ("Traceback (most recent call last):\n%s" % format_stack()) +
            dedent("""
                This could be a bug in Tortuga.
                Please report this bug as described at
                http://something something something....
            """)
        )

class TortugaError(Warning):
    """Base class for anticipated errors in the tortuga package"""
    def __init__(self, *args, **kwargs):
        super(TortugaError, self).__init__(*args, **kwargs)
        if not str(self):
            self.message = dedent(self.__class__.__doc__)